package com.example.minzhengtong.ui.adapter

import android.content.Context
import android.graphics.Color
import android.util.TypedValue
import android.view.View
import android.widget.TextView
import com.example.minzhengtong.R
import com.example.minzhengtong.utils.WUtils
import com.zhy.view.flowlayout.FlowLayout
import com.zhy.view.flowlayout.TagAdapter

/**
 * created by WY on 2021/4/7.
 * 热门搜索和历史搜索适配器
 */
class AdapterLike(val baseContext : Context, datas: MutableList<String>?) : TagAdapter<String>(datas) {

    override fun getView(parent: FlowLayout?, position: Int, t: String): View {
        val item = TextView(baseContext)
        val topPadding = WUtils.dp2px(baseContext,5f)
        val leftPadding = WUtils.dp2px(baseContext,15f)
        item.setPadding(leftPadding,topPadding,leftPadding,topPadding)
        item.setBackgroundResource(R.drawable.bg_like)
        item.setTextColor(baseContext.resources.getColor(R.color.textColor333))
        item.setTextSize(TypedValue.COMPLEX_UNIT_SP,12f)
        item.text = t
        return item
    }

}